#if !defined(AFX_APPLICATION_H__B479A5BE_0A0A_426F_BF03_E6A1EB5D774D__INCLUDED_)
#define AFX_APPLICATION_H__B479A5BE_0A0A_426F_BF03_E6A1EB5D774D__INCLUDED_

#include "Window.h"	// Added by ClassView
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// Application.h : header file
//

typedef enum enumScriptType
{
	ScriptType_VBScript,
	ScriptType_JScript,
	ScriptType_Unknown,
} enumScriptType;

/////////////////////////////////////////////////////////////////////////////
// Application command target

class Application : public CCmdTargetPlus
{
	friend class CScriptManager;
	DECLARE_DYNCREATE(Application)

	Application();           // protected constructor used by dynamic creation
	virtual ~Application();

// Scripting support
public:
	// XX ActiveX Scripting XX
	BOOL RunScript(LPCTSTR szScriptText, enumScriptType scriptType);
	CMapStringToOb mapNamedItems;
	BOOL m_bScriptIsRunning;
	IActiveScriptParse* m_pScriptParser;
	IActiveScript* m_pScriptEngine;
	DECLARE_OLETYPELIB(Application)

// Attributes
public:

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(Application)
	public:
	virtual void OnFinalRelease();
	//}}AFX_VIRTUAL

// Implementation
protected:

	DECLARE_MESSAGE_MAP()
	DECLARE_INTERFACE_MAP()
	DECLARE_DISPATCH_MAP()
	DECLARE_EVENT_MAP()

	// Generated message map functions
	//{{AFX_MSG(Application)
		// NOTE - the ClassWizard will add and remove member functions here.
	//}}AFX_MSG

protected:
	BOOL StartEngine(enumScriptType scriptType);
	void StopEngine();
	BEGIN_INTERFACE_PART(ActiveScriptSite, IActiveScriptSite)
		STDMETHOD(GetLCID)(LCID*);
		STDMETHOD(GetItemInfo)(LPCOLESTR, DWORD, LPUNKNOWN*, LPTYPEINFO*);
        STDMETHOD(GetDocVersionString)(BSTR*);
        STDMETHOD(OnScriptTerminate)(const VARIANT*, const EXCEPINFO*);
        STDMETHOD(OnStateChange)(SCRIPTSTATE);
        STDMETHOD(OnScriptError)(IActiveScriptError*);
        STDMETHOD(OnEnterScript)();
        STDMETHOD(OnLeaveScript)();
	END_INTERFACE_PART(ActiveScriptSite)

	BEGIN_INTERFACE_PART(ActiveScriptSiteWindow, IActiveScriptSiteWindow)
		STDMETHOD(EnableModeless)(BOOL);
		STDMETHOD(GetWindow)(HWND*);
	END_INTERFACE_PART(ActiveScriptSiteWindow)

public:
	// Dispatch maps
	// Generated OLE dispatch map functions
	//{{AFX_DISPATCH(Application)
	afx_msg BSTR GetVersion();
	afx_msg LPDISPATCH GetWindow();
	afx_msg BSTR GetPath();
	//}}AFX_DISPATCH

	
public:
	// Event maps
	//{{AFX_EVENT(Application)
	void FireOnEventTest()
		{FireEvent(eventidOnEventTest,EVENT_PARAM(VTS_NONE));}
	void FireOnQuit()
		{FireEvent(eventidOnQuit,EVENT_PARAM(VTS_NONE));}
	//}}AFX_EVENT


public:
	Window m_xWindow;
	enum {
	//{{AFX_DISP_ID(Application)
	dispidVersion = 1L,
	dispidWindow = 2L,
	dispidPath = 3L,
	eventidOnEventTest = 1L,
	eventidOnQuit = 2L,
	//}}AFX_DISP_ID
	};
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_APPLICATION_H__B479A5BE_0A0A_426F_BF03_E6A1EB5D774D__INCLUDED_)
